package org.bbelovic.devel.exercises.sequences.impl;

import java.util.ArrayList;
import java.util.List;

import org.bbelovic.devel.exercises.NumberUtilities;
import org.bbelovic.devel.exercises.sequences.SequenceGenerator;

public class PrimeNumbersSequenceGenerator implements SequenceGenerator {

    public List<Integer> generateSequence(final int n) {
        final List<Integer> result = new ArrayList<Integer>();
        int i = 2;
        while (result.size() != n) {
            if (NumberUtilities.isPrime(i)) result.add(i);
            i++;
        }
        return result;
    }

}
